package com.andy.module.ext

import android.widget.TextView
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.list.SingleChoiceListener
import com.afollestad.materialdialogs.list.listItemsSingleChoice
import com.andy.module.bean.CodeBean


/**
 * 打开等待框
 */
fun TextView.showChooseListExt(dialogTitle: String, codeSource: MutableList<CodeBean>, listener: SingleChoiceListener) {
    val itemList = codeSource.map { it.value }
    val dialog = MaterialDialog(context)
        .title(text = dialogTitle)
        .cancelable(true)
        .cancelOnTouchOutside(false)
        .cornerRadius(12f)
        .listItemsSingleChoice(items = itemList, selection = listener)
    dialog.show()
}


